<!--
 * @Description: 招聘内页
 * @Version: 2.0
 * @Autor: Seven
 * @Date: 2020-12-10 11:37:45
 * @LastEditors: Seven
 * @LastEditTime: 2020-12-15 13:53:17
-->
<template>
    <div class="containers-warp">
        <div class="containers">
            <div class="detail-wrap">
                <h1 class="title">{{info.title}}</h1>
                <div class="s1">
                    <span>来源：{{info.source}}</span>
                    <span>时间：<span>{{dateFormat(info.createTime,'Y-m-d H:i:s')}}</span></span>
                </div>
                <div class="information" v-exchangeHtml="info.content">
                </div>

                <div class="recommendList">
                    <bar
                        title="为你推荐"
                        :icon="true"
                        titleSize="max"
                        :isFull="true"
                    >
                        <el-row :gutter="20">
                            <el-col
                                :xs="12"
                                :sm="8"
                                :md="6"
                                :lg="6"
                                v-for="(item, index) in recommendList"
                                :key="index"
                                v-if="index < 4"
                            >
                                <course-box :data="item"></course-box>
                            </el-col>
                        </el-row>
                    </bar>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
export default {
    data(){
        return{
            // 为你推荐
            recommendList: [
            ],
            info:''
        }
    },
    async asyncData({ params, app }){
        const ID = params.id;
        // 好课推荐
        let getRecommendList = app.$axios
            .$get(`/edu/course/courseRecommend`)
            .then((res) => {
                if (res.code === 0) {
                    return res.data;
                }
            });

        // 获取招聘详情
        let getInfo = app.$axios
            .$get(`/edu/recruit/info/${ID}`)
            .then((res) => {
                if (res.code === 0) {
                    return res.data;
                }
            });

        let recommendList = await getRecommendList;
        let info = await getInfo;
        return{
            recommendList,
            info
        }
    },
};
</script>
<style lang="scss" scoped>
.detail-wrap {
    padding: 20px 0;
    .title {
        font-size: 24px;
        color: #333333;
        margin-bottom: 10px;
    }
    .s1 {
        font-size: 14px;
        color: #999999;
        margin-bottom: 10px;
        span + span {
            margin-left: 10px;
        }
    }
    .recommendList{
        margin-top: 10px;
    }
}
</style>
<style lang="scss">
    .information {
        p {
            color: #333333;
            font-size: 16px;
            line-height: 1.5;
        }
    }
</style>